from django.http import HttpRequest
from django.test import TestCase
from django.urls import resolve
from lists.views import home
from django.template.loader import render_to_string
from django.test import TestCase

# Create your tests here.


class SmokeTest(TestCase):
    def test_这是一个测试用例1(self):
        found = resolve('/')
        self.assertEqual(found.func,home)
    def test_用例2(self):
        res = self.client.get('/')
        html = res.content.decode('utf8')
        self.assertTrue(html.startswith('<html>'))
        self.assertIn('<title>首页!</title>',html)
        e_html = render_to_string('home.html')
        self.assertEqual(html,e_html)
        self.assertTemplateUsed(res,'home.html')
